﻿@model OrchardCore.ContentFields.ViewModels.EditBooleanFieldViewModel
@using OrchardCore.ContentFields.Settings;
@using OrchardCore.ContentManagement.Metadata.Models
@{
    var settings = Model.PartFieldDefinition.Settings.ToObject<BooleanFieldSettings>();
    string id = Html.IdFor(m => m.Value);
}

<script asp-name="bootstrap-switch" depends-on="admin" asp-src="/OrchardCore.Resources/Scripts/bootstrap-switch.min.js" debug-src="/OrchardCore.Resources/Scripts/bootstrap-switch.js" at="Foot"></script>
<style asp-name="bootstrap-switch" asp-src="/OrchardCore.Resources/Styles/bootstrap-switch.min.css" debug-src="/OrchardCore.Resources/Styles/bootstrap-switch.css"></style>

<fieldset class="form-check">
    <label class="form-check-label" asp-for="Value">
        <input asp-for="Value" type="checkbox" class="form-check-input content-preview-select" checked="@Model.Value" data-label-text="@settings.Label" />
        @if (!String.IsNullOrEmpty(settings.Hint))
        {
            <span class="hint">@T["— {0}", settings.Hint]</span>
        }
    </label>
</fieldset>
<script at="Foot">
    $(function () {
        $('#@(id)').bootstrapSwitch();
    });
</script>